package org.yaac.shared.util;

import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;

/**
 * @author Max Zhu (thebbsky@gmail.com)
 *
 */
public class StringUtils {

	/**
	 * @param s1
	 * @param s2
	 * @return
	 */
	public static int compare(String s1, String s2) {
		return ComparisonChain.start().compare(
				s1, s2, Ordering.natural().nullsLast()).result();
	}
	
	/**
	 * @param s1
	 * @param s2
	 * @return
	 */
	public static boolean sameStr(String s1, String s2) {
		return compare(s1, s2) == 0;
	}
	
	/**
	 * @param body
	 * @param headAndEnd
	 * @return
	 */
	public static String wrap(String body, String headAndEnd) {
		return wrap(body, headAndEnd, headAndEnd);
	}
	
	/**
	 * @param body
	 * @param head
	 * @param end
	 * @return
	 */
	public static String wrap(String body, String head, String end) {
		return head + body + end;
	}
}
